<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模板标签</title>
    <style>
        .red{
            background-color: red;

        }
        .yellow{
            background-color: yellow;
        }
        .block{
            background-color: black;
        }

    </style>
</head>
<body>
<ul>
   {% for name in username%}
       {% if name.id <= 2 %}
       <li class="red">{{ forloop.counter}}--{{name.usename}}</li>
       {% else %}
       <li class="yellow">{{ forloop.counter}}--{{name.usename}}</li>
       {% endif %}
   {% endfor%}
</ul>
</body>
</html>